package com.kob.backend.controller.product;

import com.kob.backend.pojo.product;
import com.kob.backend.service.product.ProductSearchByPriceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class ProductSearchByPriceController {
    @Autowired
    private ProductSearchByPriceService productSearchByPriceService;
    @GetMapping("/product/searchByprice")
    public List<product> searchByprice(@RequestParam Map<String,String> map){
        Double min_price=Double.parseDouble(map.get("min_price"));
        Double max_price=Double.parseDouble(map.get("max_price"));
        return productSearchByPriceService.searchByprice(min_price,max_price);
    }

}
